﻿#ifndef THREADCONTROL_H
#define THREADCONTROL_H

#include <QObject>
#include "API_BaseWidget.h"

class QThread;

namespace BaseWidget
{
    class ThreadTask;

    class API_BASEWIDGET ThreadControl : public QObject
    {
        Q_OBJECT
    public:
        explicit ThreadControl(ThreadTask* task);
        ~ThreadControl();

        //获取自定义线程id
        QString getUUID();

    signals:
        void signal_threadStart();
        void signal_threadStop();
        // 移除任务线程从线程管理中
        void signal_removeThread(QString uuid);

    private slots:
        void slot_deleteThread();
        // 线程休眠指定毫秒
        void slot_sleepThread(int msec);
        // 线程启动
        void slot_startThread();

    private:
        QString m_uuid{};   //自定义线程ID
        ThreadTask* m_threadTask;
        QThread* m_thread;
    };
}
#endif // THREADCONTROL_H
